package creative.fire.interview.technicolor;

public class ToInt {
	public static void main(String[] args) {
		System.out.println(to("1849262357"));
		System.out.println(to("-636506834"));
	}

	public static int to(String chars) {
		char[] cs = chars.toCharArray();
		int value = 0;
		for (int i = cs[0] == '-' ? 1 : 0; i < cs.length; i++) {
			value += cs[i] - '0';
			if (i < cs.length - 1)
				value *= 10;
		}
		return cs[0] == '-' ? -value : value;
	}
}